package entity

import (
	"time"

	"gorm.io/gorm"
	"shqsoft.cn/pas3ui/base"
)

//ShBlkhDivi 不良客户认定
type ShBlkhDivi struct {
	CUID      int        `gorm:"AUTO_INCREMENT;primary_key;column:CUID"`
	CUNO      string     `gorm:"column:CUNO"`
	ENCD      string     `gorm:"column:ENCD"`
	CUNM      string     `gorm:"column:CUNM"`
	QYGM      string     `gorm:"column:QYGM"`
	BLDT      *time.Time `gorm:"column:BLDT;type:date;"`
	GMDT      *time.Time `gorm:"column:GMDT;type:date;"`
	ISBL      string     `gorm:"column:ISBL"`
	BLCaption string     `gorm:"-"`
	ISGM      string     `gorm:"column:ISGM"`
	GMCaption string     `gorm:"-"`
}

//TableName 对公账户表名
func (ShBlkhDivi) TableName() string {
	return "SH_V_COMP_BLKH"
}

func (q *ShBlkhDivi) AfterFind(*gorm.DB) (err error) {
	if q.ISBL == "1" {
		q.BLCaption = "是"
	} else {
		q.BLCaption = "否"
	}
	if q.ISGM == "1" {
		q.GMCaption = "是"
	} else {
		q.GMCaption = "否"
	}
	return
}
func ShBlkhDiviEF() base.EntityFunc {
	return func() interface{} {
		entity := ShBlkhDivi{}
		return &entity
	}
}
func ShBlkhDiviESF() base.EntitiesFunc {
	return func() interface{} {
		var entities []ShBlkhDivi
		return &entities
	}
}

func init() {
	dao := base.NewDefaultDao(ShBlkhDiviEF(), ShBlkhDiviESF(), nil, "ch")
	base.DaoPoolObj.Put("ShBlkhDivi", dao)
}
